import React from 'react'

import { Handle, Position, type NodeProps } from '@xyflow/react'

import { type CNode } from '../types'

// export function PositionLoggerNode({ positionAbsoluteX, positionAbsoluteY, data }: NodeProps<PositionLoggerNode>) {
//   const x = `${Math.round(positionAbsoluteX)}px`
//   const y = `${Math.round(positionAbsoluteY)}px`

//   return (
//     // We add this class to use the same styles as React Flow's default nodes.
//     <div className="react-flow__node-default" style={{ color: 'red' }}>
//       {data.label && <div>{data.label}</div>}

//       <div>
//         {x} {y}
//       </div>

//       <Handle type="target" position={Position.Left} />
//       <Handle type="source" position={Position.Right} />
//     </div>
//   )
// }

export default function Cnode({ positionAbsoluteX, positionAbsoluteY, data }: NodeProps<CNode>) {
  const onConnect = (params: any) => {
    console.log('onConnect', params)
  }
  const onConnect1 = (params: any) => {
    console.log('onConnect1', params)
  }
  return (
    <div className="react-flow__node-default">
      我是c节点
      <Handle type="target" position={Position.Left} onConnect={(e) => onConnect(e)} />
      <Handle type="source" position={Position.Right} onConnect={(e) => onConnect1(e)} />
    </div>
  )
}
